/**
 * Created by huachuan on 2016/1/3.
 */
angular.module("starter.directive", [])
  .directive('setFocus', function(){
    return function(scope, element){
      element[0].focus();
    };
  })
  //隐藏底部导航
  .directive('hideTabs',function($rootScope){
    return {
      restrict:'AEC',
      link:function($scope){
        $rootScope.hideTabs = 'tabs-item-hide';
        $scope.$on('$destroy',function(){
          $rootScope.hideTabs = '';
        })
      }
    }
  })
  .directive('errSrc', function() {
  return {
    link: function(scope, element, attrs) {
      element.bind('onload', function() {
        // alert("have Loading");
        if (attrs.src != attrs.errSrc) {
          attrs.$set('src', attrs.errSrc);
        }
      });
    }
  }
});
